#ifndef __GAME_LAYER_H__
#define __GAME_LAYER_H__

#include "cocos2d.h"
#include "SimpleAudioEngine.h"

#include "CMyGameDef.h"

using namespace cocos2d;

class CMyGameBase;

typedef struct tagKeyInfo
{
	bool m_bPress;
	float m_fPressTime;
} KeyInfo;

class GameLayer : public cocos2d::CCLayer
{
public:
	virtual ~GameLayer(void);
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();  

    // a selector callback
    virtual void menuCallback(CCObject* pSender);

    // implement the "static node()" method manually
    CREATE_FUNC(GameLayer);

	void updateGame(float dt);
	void initGame(void);

protected :
	virtual void didAccelerate(CCAcceleration* pAccelerationValue);

protected :
	CCSpriteBatchNode *m_pSpriteBatch;
	CCTMXTiledMap *m_pMap;
	CCTMXLayer *m_pTileLayer;
	KeyInfo m_KeyInfo[MAX_GAME_KEYS];
	bool m_bKeyByAccel;
};

#endif  // __GAME_LAYER_H__